<?php defined('BASEPATH') or exit('No direct script access allowed');

class Module_Cirpho extends Module {

	public $version = 0.9;

	public function info()
	{
		return array(
			'name' => array(
				'sl' => 'Kontakt',
				'en' => 'Cirpho Management'
			),
			'description' => array(
				'sl' => 'Dodaj obrazec za kontakt da vam lahko obiskovalci email naslov.',
				'en' => 'Cirpho Management'
				),
			'frontend' => TRUE,
			'backend' => TRUE,
			'menu'		=> 'content'
		);
	}

	public function install()
	{
		$this->dbforge->drop_table('cip_categories');
		$this->dbforge->drop_table('cip_groups');
		$this->dbforge->drop_table('cip_owners');
		$this->dbforge->drop_table('cip_samples');
		$this->dbforge->drop_table('cip_settings');
		$this->db->query("
			CREATE  TABLE IF NOT EXISTS ".$this->db->dbprefix('cip_categories')." (
			  `id` INT NOT NULL AUTO_INCREMENT ,
			  `name` VARCHAR(45) NULL ,
			  PRIMARY KEY (`id`)
			) ENGINE=InnoDB DEFAULT CHARSET=utf8
		");
		$this->db->query("
			CREATE  TABLE IF NOT EXISTS ".$this->db->dbprefix('cip_groups')." (
			  `id` INT NOT NULL AUTO_INCREMENT ,
			  `title` VARCHAR(45) NULL ,
			  `category_id` INT NULL ,
			  `owner_id` INT NULL ,
			  `comment` VARCHAR(255) NULL ,
			  `url` VARCHAR(255) NULL ,
			  `note` VARCHAR(255) NULL ,
			  PRIMARY KEY (`id`)
			) ENGINE=InnoDB DEFAULT CHARSET=utf8
		");
		$this->db->query("
			CREATE  TABLE IF NOT EXISTS ".$this->db->dbprefix('cip_owners')." (
			  `id` INT NOT NULL AUTO_INCREMENT ,
			  `name` VARCHAR(45) NULL ,
			  PRIMARY KEY (`id`)
			) ENGINE=InnoDB DEFAULT CHARSET=utf8
		");
		$this->db->query("
			CREATE  TABLE IF NOT EXISTS ".$this->db->dbprefix('cip_samples')." (
			  `id` INT NOT NULL AUTO_INCREMENT ,
			  `image` VARCHAR(255) NULL ,
			  `group_id` INT NULL ,
			  PRIMARY KEY (`id`)
			) ENGINE=InnoDB DEFAULT CHARSET=utf8
		");
		return $this->db->query("
			CREATE  TABLE IF NOT EXISTS ".$this->db->dbprefix('cip_settings')." (
			  `id` INT NOT NULL AUTO_INCREMENT ,
			  `name` VARCHAR(45) NULL ,
			  `value` FLOAT NULL ,
			  PRIMARY KEY (`id`)
			) ENGINE=InnoDB DEFAULT CHARSET=utf8
		");
	}

	public function uninstall()
	{
		//it's a core module, lets keep it around
		$this->dbforge->drop_table('cip_categories');
		$this->dbforge->drop_table('cip_groups');
		$this->dbforge->drop_table('cip_owners');
		$this->dbforge->drop_table('cip_samples');
		$this->dbforge->drop_table('cip_settings');
		return TRUE;
	}

	public function upgrade($old_version)
	{
		// Your Upgrade Logic
		return TRUE;
	}

	public function help()
	{
		// Return a string containing help info
		// You could include a file and return it here.
		return "This module has no inline docs as it does not have a back-end.";
	}
}
/* End of file details.php */